package com.baseproject.imageload;

import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;

/**
 * 策略模式，按需选择图片加载框架
 */

public class ImageLoaderUtil{
    public static final int PIC_LARGE = 0;
    public static final int PIC_MEDIUM = 1;
    public static final int PIC_SMALL = 2;

    public static final int LOAD_STRATEGY_NORMAL = 0;
    public static final int LOAD_STRATEGY_ONLY_WIFI = 1;

    private static ImageLoaderUtil mInstance;

    private ImageLoaderUtil(){
    }

    //single instance
    public static ImageLoaderUtil getInstance(){
        if(mInstance ==null){
            synchronized (ImageLoaderUtil.class){
                if(mInstance == null){
                    mInstance = new ImageLoaderUtil();
                    return mInstance;
                }
            }
        }
        return mInstance;
    }

    public BaseImageLoaderStrategy with(Context context) {
        return new GlideImageLoaderStrategy().with(context);
    }

    public BaseImageLoaderStrategy with(Fragment fragment) {
        return new GlideImageLoaderStrategy().with(fragment);
    }

    public BaseImageLoaderStrategy with(Activity activity) {
        return new GlideImageLoaderStrategy().with(activity);
    }

}
